package test;
/*
 * Multiple Windows Test. Creates two duplicate windows inside a larger desktop window. 
 * lightly modified from Prof. Pearce
 * Duc Nguyen 2009
 */

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;


class TableFrame extends JInternalFrame {
	private static final long serialVersionUID = 1L;
	private static int openFrameCount = 0;
	
	TableFrame(){
		super("Document #" + (++openFrameCount),
              true, //resizable
              true, //closable
              true, //maximizable
              true);//iconifiable
        ConverterGUI view = new ConverterGUI();
        setContentPane(view);
        pack();
	}
}

public class ParentAppFrame extends JFrame implements ActionListener {

	private static final long serialVersionUID = 1L;
	private JDesktopPane desktop;
	

	public ParentAppFrame() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setDefaultLookAndFeelDecorated(true);
		desktop = new JDesktopPane(); //a specialized layered pane
		
        createFrame(); //create first "window"
        setContentPane(desktop);
        

        //Make dragging a little faster but perhaps uglier.
        desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
	}

	public void actionPerformed(ActionEvent e) {
        if ("new".equals(e.getActionCommand())) { //new
            createFrame();
        } else { //quit
            System.exit(1);
        }
    }

    //Create a new internal frame.
    protected void createFrame() {
        TableFrame frame = new TableFrame();
        frame.setVisible(true); //necessary as of 1.3
        
        TableFrame frame2 = new TableFrame();
        frame2.setVisible(true); //necessary as of 1.3
        
        desktop.add(frame);
        desktop.add(frame2);

        try {
            frame.setSelected(true);
        } catch (java.beans.PropertyVetoException e) {}

    }

	public static void main(String[] args) {
      ParentAppFrame frame = new ParentAppFrame();
      frame.setSize(600, 400);
      frame.setTitle("App Frame");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setVisible(true);
   }



}